import request from '@/utils/request'
// 获取角色列表
export function getRolesListApi () {
  return request({
    url: '/api/roles',
    method: 'get'
  })
}

// 删除角色权限
export function deleteRoleRightsApi (query) {
  return request({
    url: '/api/roles/' + query.id + '/rights/' + query.rightId,
    method: 'delete'
  })
}

// 为角色授权
export function postRoleRightsApi (data) {
  return request({
    url: '/api/roles/' + data.roleId + '/rights',
    method: 'post',
    data
  })
}

// 添加角色
export function postAddRoleApi (data) {
  return request({
    url: '/api/roles',
    method: 'post',
    data
  })
}

// 删除角色
export function deleteRoleApi (query) {
  return request({
    url: '/api/roles/' + query,
    method: 'delete'
  })
}

// 根据Id查询角色
export function getRoleByIdApi (query) {
  return request({
    url: '/api/roles/' + query,
    method: 'get'
  })
}

// 编辑角色信息
export function putRoleByIdApi (query, data) {
  return request({
    url: '/api/roles/' + query.id,
    method: 'put',
    params: query,
    data
  })
}
